
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Text;

using Swaf;
using Swaf.BizObj;
using Swaf.BizRule;
using Swaf.Security;
namespace UserManagement
{
	public class UserManagementTemplateBizRules : Syrinx.BaseBizRules
	{
		public string getLimitsDisplayTemplate(IApplication app, IRuleContext context, IBizObj bizobj, Privileges editPriv
				, string parentBPIds, string pageName)
		{
			if (bizobj != null)
			{
				return "UserManagement.Gui.AspNet.MembershipLimitsRWDisplay";
			}
			return "UserManagement.Gui.AspNet.MembershipLimitsRODisplay";
		}

		public string getUserLimitsDisplayTemplate(IApplication app, IRuleContext context, IBizObj bizobj, Privileges editPriv
				, string parentBPIds, string pageName)
		{
			return "";
		}

		public string getCompanySettingsDisplayTemplate(IApplication app, IRuleContext context, IBizObj bizObj, Privileges editPriv
				, string parentBPIds, string pageName)
		{
			if (ActiveCompany.get("parentId") == null)
				return "UserManagement.Gui.AspNet.BasicCompanySettingsDisplay";
			else
				return "UserManagement.Gui.AspNet.BasicCompanySettingsRODisplay";
		}
		public object getCompanyUsersBackupRestoreTemplate(IApplication app, IRuleContext context, object resultValue, object[] inputParams)
		{
			string template = "UserManagement.Gui.AspNet.BaseDeploymentOptions";
			if (resultValue != null)
				return resultValue.ToString().Length == 0 ? template
					: new StringBuilder(50).Append(resultValue.ToString()).Append(",").Append(template).ToString();
			return template;
		}
	}
}
